﻿@model IniTechCaash.WebApplication.Models.FinanceAccountDetailsViewModel
@using IniTechCaash.Domain.Entities

@{
    ViewBag.Title = "Details";
}

<h2>Details</h2>

<div>
    <h4>@Html.DisplayFor(model => model.CompositeId)</h4>
	<hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.CreatedBy)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.CreatedBy)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.CreatedDate)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.CreatedDate)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.LastModifiedBy)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.LastModifiedBy)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.LastModifiedDate)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.LastModifiedDate)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Balance)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Balance)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Description)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Description)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.IsEnabled)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.IsEnabled)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Name)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Name)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Number)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Number)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Type)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Type)
        </dd>

    </dl>
</div>
<h4>Lines</h4>
<hr />
@if (Model.Lines != null && Model.Lines.Count > 0)
{
    <table class="table">
        <thead>
            <tr>
                <th>PR</th>
                <th>Amount</th>
                <th>Date</th>
                <th>Posted</th>
                <th>Description</th>
            </tr>
        </thead>
        <tbody>
            @for (int i = 0; i < Model.Lines.Count; ++i)
            {
                <tr>
                    @if (Model.Lines[i].Side == NormalSide.Debit)
                    {
                        <td>@Html.ActionLink(Model.Lines[i].JournalEntry.DescriptiveId, "Details", "Journal", new { id = Model.Lines[i].JournalEntry.Id }, null)</td>
                        <td>@Html.DisplayFor(model => model.Lines[i].Amount)</td>
                    }
                    else
                    {
                        <td class="credit-indent">@Html.ActionLink(Model.Lines[i].JournalEntry.DescriptiveId, "Details", "Journal", new { id = Model.Lines[i].JournalEntry.Id }, null)</td>
                        <td class="credit-indent">@Html.DisplayFor(model => model.Lines[i].Amount)</td>
                    }
                    <td>@Html.DisplayFor(model => model.Lines[i].Date)</td>
                    <td>@Html.DisplayFor(model => model.Lines[i].JournalEntry.DatePosted)</td>
                    <td>@Html.DisplayFor(model => model.Lines[i].Description)</td>
                </tr>
            }
        </tbody>
    </table>
}
else
{
    <p>No posted entires</p>
}
<hr />
@{
    Html.RenderPartial("_ActivityLogPartial", Model.ActivityLogs);
}
<hr />
@if (User.IsInRole("Admin"))
{
    <p>
        @Html.ActionLink("Edit", "Edit", new { id = Model.Id }) |
        @Html.ActionLink("Back to List", "Index")
    </p>
}
else
{
    <p>
        @Html.ActionLink("Back to List", "Index")
    </p>
}
